*******************************************************************************
******************************  TABLE A7  *************************************
***********  Effects of Group Gender Composition on Women's Influence  ********
*******************************************************************************

clear all
set more off
program drop _all

//cd "C:/Users/ganth/Dropbox/StrengthInNumbersReplicationPackage/replicable/table_a7"

********************************************************************************

use "table_a7_dataset.dta", clear

**Panel 1: Team-Building Most Influential Votes
eststo clear
eststo: reg genderminfl_ratio_ravg maleMajority if study ==1 [w = CESSampleweightforStudy1], robust
estadd ysumm
eststo: reg genderminfl_ratio_ravg maleMajority if study ==2 [w = CESSampleweightforStudy2], robust
estadd ysumm
eststo: reg genderminfl_ratio_ravg maleMajority [w = CESSampleweightforCombStudy12], robust
estadd ysumm

**This creates the LaTex file for the first part of the table
esttab _all using "table_a7_p1.tex", style(tex) ///
 stats(ymean ysd, fmt(%9.2f %9.2f) ///
labels("Mean of outcome" "St. dev. of outcome")) label replace ///
keep(maleMajority) ///
star( * .1 ** .05 *** .01) b(%9.3f) se(%9.3f) nogaps  ///
mtitles("Study 1" "Study 2" "Studies 1 + 2") ///
nonotes nonum 


**Panel 2: Team-Building Incentivized Spokesperson Votes
eststo clear
eststo: reg genderspokes_ratio_ravg maleMajority if study ==1 [w = CESSampleweightforStudy1], robust
estadd ysumm
eststo: reg genderspokes_ratio_ravg maleMajority if study ==2 [w = CESSampleweightforStudy2], robust
estadd ysumm
eststo: reg genderspokes_ratio_ravg maleMajority [w = CESSampleweightforCombStudy12], robust
estadd ysumm

	
**This creates the LaTex file for the second part of the table.
esttab _all using "table_a7_p2.tex", style(tex) ///
 stats(ymean ysd, fmt( %9.2f %9.2f) ///
labels("Mean of outcome" "St. dev. of outcome")) label replace ///
keep(maleMajority) ///
star( * .1 ** .05 *** .01) b(%9.3f) se(%9.3f) nogaps  ///
mtitles("Study 1" "Study 2" "Studies 1 + 2") ///
nonotes nonum 

**Panel 3: Global Assessment Perceived Most Influential Votes (pre-leader assignment) -- restricted to same groups as completed the team-building task
eststo clear
eststo: reg femvotesminfl_avgpre_ratio maleMajority if genderminfl_ratio_ravg!=. & study ==1 [w = CESSampleweightforStudy1], robust
estadd ysumm
eststo: reg femvotesminfl_avgpre_ratio maleMajority if genderminfl_ratio_ravg!=. & study ==2 [w = CESSampleweightforStudy2], robust
estadd ysumm
eststo: reg femvotesminfl_avgpre_ratio maleMajority if genderminfl_ratio_ravg!=. [w = CESSampleweightforCombStudy12], robust
estadd ysumm


**This creates the LaTex files for the 3rd part of the table
esttab _all using "table_a7_p3.tex", style(tex) ///
stats(ymean ysd, fmt(  %9.2f %9.2f) ///
labels("Mean of outcome" "St. dev. of outcome")) label replace ///
keep(maleMajority) ///
star( * .1 ** .05 *** .01) b(%9.3f) se(%9.3f) nogaps  ///
mtitles("Study 1" "Study 2" "Studies 1 + 2") ///
nonotes nonum 

**Panel 4: Team-Building Least Influential Votes
eststo clear
eststo: reg genderlinfl_ratio_ravg maleMajority if study ==1 [w = CESSampleweightforStudy1], robust
estadd ysumm

eststo: reg genderlinfl_ratio_ravg maleMajority if study == 2 [w = CESSampleweightforStudy2], robust
estadd ysumm

eststo: reg genderlinfl_ratio_ravg maleMajority [w = CESSampleweightforCombStudy12], robust
estadd ysumm


**This creates the LaTex files for the 4th part of the table
esttab _all using "table_a7_p4.tex", style(tex) ///
 stats(ymean ysd, fmt(%9.2f %9.2f) ///
labels("Mean of outcome" "St. dev. of outcome")) label replace ///
keep(maleMajority) ///
star( * .1 ** .05 *** .01) b(%9.3f) se(%9.3f) nogaps  ///
mtitles("Study 1" "Study 2" "Studies 1 + 2") ///
nonotes nonum addnotes("\begin{minipage}{.7\linewidth} \footnotesize \smallskip \textbf{Note:} Table presents group-level analysis of the effects of majority male groups on perceptions of influence, weighted by gender and sexism. In each case, the dependent variable is votes for women divided by the proportion of women in the group. Study 2 analysis excludes 22 groups from the semester when the team-building task was not conducted. Global assessment votes also exclude those groups for purposes of comparison. In both studies, results for global assessment votes are restricted to the first two months of assessments, which are the assessments prior to the leader intervention for Study 2. Heteroskedasticity-robust standard errors are reported in parentheses. Significance levels are indicated by $*$ $<.1$, ** $<.05$,  *** $<.01$.      \end{minipage}" )



include "https://raw.githubusercontent.com/steveofconnell/PanelCombine/master/PanelCombine.do"
panelcombine, use(table_a7_p1.tex table_a7_p2.tex table_a7_p3.tex table_a7_p4.tex) ///
paneltitles("Team-Building Most Influential Votes" "Team-Building Incentivized Spokesperson Votes" "Global Assessment Most Influential Votes" "Team-Building Least Influential Votes") columncount(4) save("table_a7.tex") cleanup
